<template>
  <div>
    <h1>登录</h1>
    <p>用户名<input type="text" v-model="from.username"></p><br>
    <p>密码<input type="text" v-model="from.password"></p>
    <button @click="login">登录</button>
  </div>
</template>

<script>
export default {
  name: "Log_18",
  data() {
    return {
      from: {}
    }
  },
  methods: {
    login() {
      this.$axios.post('users/login/', this.from).then(res => {
        if (res.data.code == 200) {
          localStorage.setItem('userid', res.data.userid)
          alert('登陆成功')
          this.$router.push('/show_18/')
        }
      })
    }
  }
}
</script>

<style scoped>

</style>